package com.job.sun.HomeWork0717;

/**
 * @author 张春阳
 * @version 1.0
 * @since 2022-07-18 10:41:20
 */
public class StringBuffer01 {
    public static void main(String[] args) {
        String str= "A";
        //默认16个 + str内字符个数 17个
        long t1 = System.currentTimeMillis();
        StringBuffer sbf =new StringBuffer(str);
        for (int i=0;i<100000;i++){
            sbf.append(i);
        }
        //最后再转换为字符串类型 (常用类型)
        //StringBuffer 仅仅是为了提高String修改 计算效率
        String string = sbf.toString();
        long t2 = System.currentTimeMillis();
        System.out.println(t2-t1+"ms");
    }
}